﻿/* 兽人永不为奴！
 * 360就是傻逼！
 * 作者：Caterxy
 * 2018年1月11日
 * V 1.2.0
 * 剩下的还没想好写啥，
 * 就保佑我父母长命百岁平平安安吧。
 */
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;

namespace mvp
{
    public partial class FormMain : Form
    {
        public int i=0;
        public XmlDocument portUrl = new XmlDocument();
        public string[] urlStart= {
        "http://api.baiyug.cn/vip/index.php?url=",
        "https://api.vparse.org/?url=",
        "https://jx.maoyun.tv/index.php?id=",
        "https://api.flvsp.com/?url=",
        "http://www.sonimei.cn/?url=",
        "http://pupudy.com/play?make=url&id=",
        "http://www.qxyingyuan.vip/play?make=url&id=",
        "http://appapi.svipv.kuuhui.com/svipjx/liulanqichajian/browserplugin/qhjx/qhjx.php?id=",
        "http://api.xfsub.com/index.php?url=",
        "https://jiexi.071811.cc/jx.php?url=",
        "http://www.sfsft.com/admin.php?url=",
        "http://q.z.vip.totv.72du.com/?url=",
        "http://aikan-tv.com/?url=",
        "http://jx.api.163ren.com/vod.php?url=",
        "http://www.0335haibo.com/tong.php?url=",
        "http://www.wmxz.wang/video.php?url=",
        "http://www.vipjiexi.com/yun.php?url=",
        "http://api.1008net.com/v.php?url=",
        "http://v.renrenfabu.com/jiexi.php?url="
        };
        

        public FormMain()
        {
            InitializeComponent();
        }

        private void btn_exit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void label1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("http://shang.qq.com/wpa/qunwpa?idkey=bcd03b7efbd45f29a9cd30f3d0401e26d4d55e5e5cdbc7b58c286227156587ef");
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            //窗体透明
            //this.TransparencyKey = this.BackColor;
            portUrl.Load("https://gitee.com/caterxy/Mvp/raw/master/url/url.xml");
            urlStart = portUrl.SelectSingleNode("body").InnerText.Split(',');
            inTextBox.Focus();
        }

        private void inTextBox_TextChanged(object sender, EventArgs e)
        {
            if (Regex.IsMatch(inTextBox.Text, "v.qq.com"))
            {
                if (inTextBox.Text.Substring(0,8)!="https://")
                {
                    inTextBox.Text = "https://" + inTextBox.Text;
                }
                radioButton8.Enabled = radioButton9.Enabled = false;
                bt_1.Enabled = true;
            }
            else if (Regex.IsMatch(inTextBox.Text, "video.tudou.com"))
            {
                if (inTextBox.Text.Substring(0,7) != "http://")
                {
                    inTextBox.Text = "https://" + inTextBox.Text;
                }
                radioButton7.Enabled = radioButton9.Enabled = false;
                bt_1.Enabled = true;
            }
            else if (Regex.IsMatch(inTextBox.Text, "v.youku.com"))
            {
                if (inTextBox.Text.Substring(0, 7) != "http://")
                {
                    inTextBox.Text = "https://" + inTextBox.Text;
                }
                radioButton7.Enabled = radioButton9.Enabled = false;
                bt_1.Enabled = true;
            }
            else if (Regex.IsMatch(inTextBox.Text, "www.iqiyi.com"))
            {
                if (inTextBox.Text.Substring(0, 7) != "http://")
                {
                    inTextBox.Text = "http://" + inTextBox.Text;
                }
                radioButton7.Enabled = radioButton8.Enabled = false;
                bt_1.Enabled = true;
            }
            else if ((inTextBox.Text=="复制你要看的视频地址，粘贴在这里。") || (inTextBox.Text==""))
            {
                label2.Text = "";
            }
            else 
            {
                label2.Text = "反馈相关BUG，请进群留言。";
            }
        }

        private void radioButton1_Enter(object sender, EventArgs e)
        {
            i = 0;
        }

        private void radioButton2_Enter(object sender, EventArgs e)
        {
            i = 1;
        }

        private void radioButton3_Enter(object sender, EventArgs e)
        {
            i = 2;
        }

        private void radioButton4_Enter(object sender, EventArgs e)
        {
            i = 3;
        }

        private void radioButton5_Enter(object sender, EventArgs e)
        {
            i = 4;
        }

        private void radioButton6_Enter(object sender, EventArgs e)
        {
            i = 5;
        }

        private void radioButton7_Enter(object sender, EventArgs e)
        {
            i = 6;
        }

        private void radioButton8_Enter(object sender, EventArgs e)
        {
            i = 7;
        }

        private void radioButton9_Enter(object sender, EventArgs e)
        {
            i = 8;
        }

        private void bt_1_Click(object sender, EventArgs e)
        {
            string url = urlStart[i] + inTextBox.Text;
            System.Diagnostics.Process.Start(url);
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://caterxy.gitee.io/mvp/");
        }
    }
}
